home *** CD-ROM | disk | FTP | other *** search
/ Champak 120 / Vol 120.iso / games / battlefi.swf / scripts / frame_636 / PlaceObject2_525_2023 / CLIPACTIONRECORD onClipEvent(enterFrame).as next >
Text File  |  2010-11-09  |  2KB  |  71 lines

  1. onClipEvent(enterFrame){
  2.    if(_root.vic)
  3.    {
  4.       this._y = 491.2;
  5.    }
  6.    if(_root.loss)
  7.    {
  8.       this._y = 491.2;
  9.    }
  10.    if(!this.hitTest(_root.castle))
  11.    {
  12.       this._x += speed;
  13.    }
  14.    if(duped && _root.population < _root.poptot)
  15.    {
  16.       _root.population = _root.population + 1;
  17.       _root.gold -= 1500;
  18.       i++;
  19.       duplicateMovieClip(_root.tro,"tr" + i,16384 + (20000 + i));
  20.       _root["tr" + i]._x = -6.399999999999999;
  21.       _root["tr" + i]._y = random(50) + 201.7;
  22.       duped = false;
  23.    }
  24.    if(this.hitTest(_root.castle) && !attackin)
  25.    {
  26.       this.gotoAndPlay("attk");
  27.       attackin = true;
  28.    }
  29.    if(this.dead && this._currentframe < 22)
  30.    {
  31.       this.gotoAndPlay("die");
  32.    }
  33.    f = 1;
  34.    while(f < Math.round(_root.lvl / 2 + 1))
  35.    {
  36.       if(this.hit.hitTest(_root.castle["th" + f]))
  37.       {
  38.          this.gotoAndPlay("hurt");
  39.          remaining--;
  40.          attackin = false;
  41.          _root.castle["th" + f].removeMovieClip();
  42.       }
  43.       f++;
  44.    }
  45.    if(this.dead)
  46.    {
  47.       this._x -= speed;
  48.    }
  49.    if(this.deadfull)
  50.    {
  51.       this._x = -1000000000;
  52.    }
  53.    l = 1;
  54.    while(l < _root.lvl + 1)
  55.    {
  56.       if(this.hit.hitTest(_root["a" + l]))
  57.       {
  58.          this.gotoAndPlay("hurt");
  59.          attackin = false;
  60.          remaining--;
  61.          _root["a" + l].removeMovieClip();
  62.       }
  63.       if(remaining == 0)
  64.       {
  65.          this.gotoAndPlay("die");
  66.          remaining = 500;
  67.       }
  68.       l++;
  69.    }
  70. }
  71.